package com.dou.yygh.common.exception;

import com.dou.yygh.common.result.Result;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestControllerAdvice;

/**
 * Created with IntelliJ IDEA 2021.1 x64
 *
 * @Author: 窦义超
 * @Date: 2021/08/2021/8/22/17:20
 * @Description:
 */
@RestControllerAdvice
public class GlobalExceptionHandler {
    @ExceptionHandler(Exception.class)
    public Result error(Exception e){
    e.printStackTrace();
    return Result.fail();
        }
    @ExceptionHandler(YyghException.class)
    public Result YyghExcption(YyghException e){
        e.printStackTrace();
        return Result.fail();
    }
}
